home *** CD-ROM | disk | FTP | other *** search
- void hangup()
- {
- /*
- this subroutine hangs up the modem.
- hayes protocol is used.
- first send a % character to get the distant end to stop
- sending. then put the local modem in the command mode
- and hang it up.
- Note: if manual mode was selected at dialing then we assume
- that we can not hangup the telephone because it is not a Hayes
- compatible. so send the % character and then return.
-
- this routine is slightly dependent on whether or not BIOS calls
- are used to communicate with the modem. the non-bios calls are
- faster and different time-out values are needed.
- */
- #include "nbstime.h"
- #ifdef IBMPC
- #ifdef BIOS
- int tmo = -5;
- #endif
- #ifndef BIOS
- int tmo = -18;
- #endif
- #endif
- #ifdef SUN
- int tmo = -5;
- #endif
- extern char number[30];
- char *ptr;
- char ans[400];
- char ie1 = 'K';
- char ie2 = '+';
- char ie3 = '0';
- void wrtbuf(),wait();
- int rdbuf();
- int j;
- ptr="%";
- wrtbuf(ptr);
- for(j=0; j<3; j++) wait();
- /*
- return now if manual mode dialing
- */
- if( (number[3] == 'm') || (number[3] == 'M') ) return;
- ptr="+";
- wrtbuf(ptr);
- wait();
- wrtbuf(ptr);
- wait();
- wrtbuf(ptr);
- rdbuf(ans,ie1,ie2,ie3,tmo);
- wait();
- ptr="ATH\r";
- wrtbuf(ptr);
- rdbuf(ans,ie1,ie3,ie3,tmo);
- wait();
- ptr="ATZ\r";
- wrtbuf(ptr);
- rdbuf(ans,ie1,ie3,ie3,tmo);
- }
-